class_name PlayerState
extends Node

signal state_transition_requested(state: Player.State, state_data: PlayerStateData)

var ai_behavior: AIBehavior
var player: Player
var state_data: PlayerStateData
var animation_player: AnimationPlayer
var ball: Ball
var teammate_detection_area: Area2D
var ball_detection_area:Area2D
var tackle_damage_emitter_area: Area2D

func setup(context_player: Player, context_state_data: PlayerStateData, context_animation_player: AnimationPlayer, context_ball: Ball, context_teammate_detection_area: Area2D, context_ball_detection_area: Area2D, context_tackle_damage_emitter_area: Area2D,context_ai_behavior: AIBehavior) -> void:
	player = context_player
	animation_player = context_animation_player
	state_data = context_state_data
	ball = context_ball
	teammate_detection_area = context_teammate_detection_area
	ball_detection_area = context_ball_detection_area
	ai_behavior = context_ai_behavior
	tackle_damage_emitter_area = context_tackle_damage_emitter_area
	
func state_transition(state: Player.State, data: PlayerStateData = PlayerStateData.new()) -> void:
	state_transition_requested.emit(state, data)
	
func state_register(call_func: Callable) -> void:
	state_transition_requested.connect(call_func)
	
func on_animation_complete() -> void:
	pass
	
func can_carry_ball() -> bool:
	return false
	
func can_pass_ball() -> bool:
	return false
	
func is_ready_for_kickoff() -> bool:
	return false
